#ifndef SHAPE_H
#define SHAPE_H
class Canvas;

class Shape {
public:
	virtual void draw(int style) = 0;
	virtual ~Shape() { }
};

struct Point {
public:
	double x, y;
	Point(double xx, double yy) { x = xx; y = yy; }
	void set(double xx, double yy) { x = xx; y = yy; }
};

class Dot : Shape {
private:
	Canvas* mCanvas;
	Point* mPoint;
public:
	//XXX I want to add an easy-to-use constructor like 
	//Dot(Canvans*c, double x, double y), but how should I decide
	//whether to delete mPoint or not ? I need a GC !
	Dot(Canvas* c, const Point& p);
	~Dot();
	void draw(int style='*');
};

class Line : Shape {
private:
	Canvas* mCanvas;
	Point* mPointStart;
	Point* mPointEnd;
public:
	Line(Canvas* c, const Point& start, const Point& end);
	~Line();
	Point* start() const { return mPointStart; }
	Point* end() const { return mPointEnd; }
	void draw(int style='*');
};

class Rectangle : Shape {
private:
	Canvas* mCanvas;
	Point* mPointStart;
	Point* mPointEnd;
public:
	Rectangle(Canvas* c, const Point& start, const Point& end);
	~Rectangle();
	Point* start() const { return mPointStart; }
	Point* end() const { return mPointEnd; }
	void draw(int style=0);
};

#endif
